package com.atguigu.th.demo.controller;

import com.atguigu.th.demo.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Arrays;
import java.util.List;

@Controller
public class HelloController {
    @GetMapping("test")
    public String test(Model model){
        User user=new User("峰哥",22,new User("柳岩",20,null));
        List<User> users= Arrays.asList(new User("柳岩", 21, null),
                new User("锋哥", 22, null),
                new User("杨紫", 23, null),
                new User("小鹿", 24, null));
        model.addAttribute("msg","Hello, Thymeleaf");
        model.addAttribute("user",user);
        model.addAttribute("userList",users);
        return "hello";
    }
}
